<template>
	<view class="regYzm">
		<comHeader :config="navConfig"/>
		<view class="dlTit">
			<text>我们已经发送了验证码到你的手机：</text>
			<text>15512314322</text>
		</view>
		<view class="yzmInp">
			<input type="number" maxlength="1" @input="focusClass1" :class="[isActive1 ? 'blueBorder' : '']"/>
			<input type="number" maxlength="1" @input="focusClass2" :class="[isActive2 ? 'blueBorder' : '']"/>
			<input type="number" maxlength="1" @input="focusClass3" :class="[isActive3 ? 'blueBorder' : '']"/>
			<input type="number" maxlength="1" @input="focusClass4" :class="[isActive4 ? 'blueBorder' : '']"/>
		</view>
		<view class="mintuesBox">
			<button 
			class="minuts"
			size="mini"
			 @tap="TimeBtn" 
			 :disabled="disabled"
			 :class="[disabled ? '':'blueMintues']">{{countdown}}<text v-show="timeStatus">秒后重发</text></button>
		 </view>
		<navigator url="/pages/my/mySet/loginPassword/alert3" class="logNext" @tap="logNextPsd"><image src="/static/logNext.png"></image></navigator>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				isActive1:false,
				isActive2:false,
				isActive3:false,
				isActive4:false,
				isShowStep:'',//传递给父组件
				countdown:'重新获取',
				timeStatus:false,
				disabled:false ,//重新获取按钮是否开启
				
				navConfig:{
					isFixed:false, //是否absolute布局
					left:{
						
						isShowLeft:true,
						leftGobackColor:'black', //左边返回icon颜色
					},
					mid:{
						isShowMid:true,
						text:'填写验证码'
					},
					right:{
						text:'',
						isShowRight:false,
					}
				},
			}
			
		},
		methods:{
			logNextPsd(){
				this.isShowStep = 'regPsd';
				this.$emit('sendShowPsd',this.isShowStep)
			},
			focusClass1(e){
				if(e.detail.value.length !== 0){
					this.isActive1 = true
				}else{
					this.isActive1 = false
				}
			},
			focusClass2(e){
				if(e.detail.value.length !== 0){
					this.isActive2 = true
				}else{
					this.isActive2 = false
				}
			},
			focusClass3(e){
				if(e.detail.value.length !== 0){
					this.isActive3 = true
				}else{
					this.isActive3 = false
				}
			},
			focusClass4(e){
				if(e.detail.value.length !== 0){
					this.isActive4 = true
				}else{
					this.isActive4 = false
				}
			},
			// 验证码
			TimeBtn(){
				this.countdown = 60;
				this.timeStatus = true;
				let timer = setInterval(()=>{
					--this.countdown
				},1000)
				setTimeout(()=>{
					clearInterval(timer);
					this.timeStatus = false;
					this.countdown = '重新获取';
				},60000);
				if(this.countdown == '重新获取'){
					this.disabled = false
				}else{
					this.disabled = true
				}
			}
		}
	}
</script>

<style>
	.regWrap{
		margin:0 72upx;
	}
	.regPhone{
		margin-bottom:102upx;
	}
	.regPhone .dlTit{
		font-size: 36upx;
		color: #333333;
		font-weight: bold;
		margin-bottom: 24upx;
		
	}
	.labelText{
		font-size: 28upx;
		color: #666666;
	}
	.placecLass86{
		font-size: 28upx;
		color: #000;
	}
	.placecLass{
		color: #CCCCCC;
		font-size:28upx;
	}
	.logNext{
		margin-top: 68upx;
		margin-left: 50upx;
		display: flex;
		justify-content:flex-end;
	}
	.logNext image{
		margin-right: 40upx;
		width:98upx;
		height:99upx;
	}
	.regYzm .dlTit{
		display: flex;
		flex-direction: column;
		margin-top: 100upx;
	}
	.regYzm .dlTit text:first-child{
		
		width: 450upx;
		height: 28upx;
		font-size: 28upx;
		font-family: PingFang SC Regular;
		color: rgba(102,102,102,1);
		line-height: 20upx;
		margin-left: 167upx;
		margin-top: 64upx;
	}
	.regYzm .dlTit text:nth-child(2){
		
		width: 235upx;
		height: 36upx;
		font-size: 36upx;
		font-family: PingFang SC Regular;
		color: rgba(51,51,51,1);
		line-height: 36upx;
		margin-left: 265upx;
		margin-top: 41upx;
	}
	.yzmInp{
		margin:102upx auto 0 auto;
		display: flex;
		justify-content: center;
		flex-direction:row;
	}
	.yzmInp input{
		width:100upx;
		height:70upx !important;
		padding-bottom: 20upx;
		margin-right: 50upx;
		font-size: 60upx;
		color: #333333;
		text-align: center;
		border-bottom: 1upx solid #DCDCDC;
	}
	.blueBorder{
		border-bottom: 1upx solid #55A0FF!important;
	}
	.mintuesBox{
		width:100%;
		clear: both;
		overflow: hidden;
	}
	.minuts{
		margin-right: 5upx;
		margin-top: 44upx;
		font-size:28upx;
		color:#666666;
		margin-top:44upx;
		float: right;
	}
	.minuts:after{
		border:none !important;
	}
	.blueMintues{
		color: #5696FF !important;
	}
	.dlInput_psd input{
		width:570upx;
		height:46upx;
		line-height:46upx;
		margin-top:68upx;
		border-bottom: 1upx solid #DCDCDC;
		color: #333;
	}
	.regPsd .dlTit{
		font-size: 36upx;
		color: #333333;
		font-weight: bold;
	}
</style>
